package com.appcaja.server.dao.impl;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.appcaja.server.dao.IOrdenDAO;
import com.appcaja.server.model.Orden;

/**
 * Implementacion DAO Mock para ordenes 
 *
 * @author Jere
 */

public class OrdenMockDao implements IOrdenDAO{
	private static final List<Orden> ordenes;
	
	static {
		ordenes = new ArrayList<Orden>();
		for (int i = 1; i <= 10; i++) {
			ordenes.add(new Orden(i,String.valueOf(i),"CausanteBeneficiario"+i,String.valueOf(i),String.valueOf(i)));
		}
	}

	@Override
	public List<Orden> obtenerOrdenes() {
		return ordenes;
	}

	@Override
	public Orden obtenerOrdenPorCGI(long cgi) {
		if (cgi<1 && cgi>10) {
			return null;
		}
		return this.buscarOrdenPorCGI(cgi);
	}

	private Orden buscarOrdenPorCGI(long cgi) {
		for (Orden orden : ordenes) {
			if (orden.getCgi() == cgi) {
				return orden;
			}
		}
		return null;
	}

	@Override
	public List<Orden> filtrarOrdenes(Map<String, List<String>> filtros) {
		return null;
	}
}
